import { type AxiosRequestConfig } from 'axios'
import axiosInstance, { type ApiResponse } from './request'

function get<T>(url: string, params?: {}): Promise<ApiResponse<T>> {
  return axiosInstance.get(url, { params })
}

const post = <T>(
  url: string,
  data?: {},
  config?: AxiosRequestConfig
): Promise<ApiResponse<T>> => {
  return axiosInstance.post(url, data, { ...config })
}

export { get, post }
